Система довольно простая.
Чтобы ответить на вопрос протестируйте систему.
//+------------------------------------------------------------------+
//| PriceActionScalper.mq4 |
//| Copyright © 2011, AM2 |
//| http://www.forexsystems.biz |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2011, AM2"
#property link "http://www.forexsystems.biz"
#define MAGIC 20120225
extern double StopLoss=450;
extern double TakeProfit=800;
extern int HourOn=9;
extern int HourOff=21;
extern double Lots=0.1;
//+------------------------------------------------------------------+
//| Check for open order conditions |
//+------------------------------------------------------------------+
void CheckForOpen()
{
//---- go trading only for first tiks of new bar
if(Volume[0]>1) return;
int res;
double OpenH1,OpenM30,OpenM15,OpenM5,
CloseH1,CloseM30,CloseM15,CloseM5;
OpenH1=iOpen(Symbol(),PERIOD_H1,1);
OpenM30=iOpen(Symbol(),PERIOD_M30,1);
OpenM15=iOpen(Symbol(),PERIOD_M15,1);
OpenM5= iOpen(Symbol(),PERIOD_M5,1);
CloseH1=iClose(Symbol(),PERIOD_H1,1);
CloseM30=iClose(Symbol(),PERIOD_M30,1);
CloseM15=iClose(Symbol(),PERIOD_M15,1);
CloseM5=iClose(Symbol(),PERIOD_M5,1);
//---- buy conditions
if(Hour()>=HourOn && Hour()<HourOff && (CloseH1-OpenH1)>0 && (CloseM30-OpenM30)>0 && (CloseM15-OpenM15)>0 && (CloseM5-OpenM5)>0)
{
res=OrderSend(Symbol(),OP_BUY,Lots,Ask,3,Ask-StopLoss*Point,Ask+TakeProfit*Point,"",MAGIC,0,Blue);
return;
}
//---- sell conditions
if(Hour()>=HourOn && Hour()<HourOff && (CloseH1-OpenH1)<0 && (CloseM30-OpenM30)<0 && (CloseM15-OpenM15)<0 && (CloseM5-OpenM5)<0)
{
res=OrderSend(Symbol(),OP_SELL,Lots,Bid,3,Bid+StopLoss*Point,Bid-TakeProfit*Point,"",MAGIC,0,Red);
return;
}
//----
}
//+------------------------------------------------------------------+
//| Start function |
//+------------------------------------------------------------------+
void start()
{
//---- check for history and trading
if(Bars<100 || IsTradeAllowed()==false) return;
//---- calculate open orders by current symbol
if(OrdersTotal()<1) CheckForOpen();
//----
}
//+----------------------------------------------------------------------------+